(function (mui, window) {
    var v3AceOasisMsg = window.v3AceOasisMsg = {};
    var baseRequest = window.baseRequest;
    var appConfig = window.appConfig;
    var commonTool = window.commonTool;
    var dataManager = window.dataManager;
    var locale = dataManager.getLocale();
	var baseUrl = appConfig.v3ServiceUrl + '/ace/oasis';
    //add by dongyi
    //获取告警消息列表接口
	var getOasisAlarmUrl = baseUrl + '/oasis-alarm/sendmsg/sendmsglistbypage';
	v3AceOasisMsg.getOasisAlarmList = function (userName, starTime, endTime, pageSize, currentPage,findoption, callback) {
        baseRequest.commonPost(getOasisAlarmUrl, {
    			userName: userName,
    			startTime: starTime,
    			endTime: endTime,
    			pageSize: pageSize,
    			currentPage : currentPage,
    			findoption: findoption
    		}, 10000, function(code, data){
    			if(code === 0){
				if(data == -1 || data.errmsg == 'fail') {
					callback(1);
				} else {
					callback(0, data.data);
				}
			}
			if(code === 1 || code ===2){
				return callback(2);
			}
    	})
    }
	
	//获取系统消息列表接口
	var getOasisSystemMsgUrl = baseUrl + '/oasis-rest-notification/restapp/webnotify/listWebnotifyOfLocation?';
	v3AceOasisMsg.getOasisSystemMsg = function (user_info, notify_location, start, size, callback) {
        baseRequest.commonGet(getOasisSystemMsgUrl + mui.param({
        	user_info:user_info,
        	notify_location:notify_location,
        	start: start,
        	size: size
        }), 10000, function (code, data) {
            if (code === 2 || code === 1) {
                return callback(2);
            }
            if (code === 0) {
                if (data.code === 0) {
                	callback(0,data.data);
                } else {
                    callback(1);
                }
            }
        });
    }
	
	//通过userName获取userId的接口
	var getUserIdUrl = baseUrl + '/oasis-rest-user/restapp/users/detail?';
	v3AceOasisMsg.getUserId = function(user_name,callback){
		baseRequest.commonGet(getUserIdUrl + mui.param({user_name:user_name}), 10000, function (code, data) {
            if (code === 2 || code === 1) {
                return callback(2);
            }
            if (code === 0) {
                if (data.code === 0) {
                	callback(0,data.data);
                } else {
                    callback(1);
                }
            }
        });
	}
	//获取用户详情信息的接口
	var getUserInfoUrl = baseUrl + '/oasis-rest-user/restapp/users/detail?';
	v3AceOasisMsg.getUserInfo = function(callback){
		baseRequest.commonGet(getUserInfoUrl, 10000,function(code,data){
			if (code === 2 || code === 1) {
                return callback(2);
            }
            if (code === 0) {
                if (data.code === 0) {
                	callback(0,data.data);
                } else {
                    callback(1);
                }
            }
		});
	}
	//获取操作日志列表接口
	var getOperationLogUrl = baseUrl + '/oasis-log/operation_logs/getAllSubLog?';
	v3AceOasisMsg.getOperationLog = function(user_name,userId,starTime, endTime,start,size,callback){
		baseRequest.commonGet(getOperationLogUrl + mui.param({
			user_name:user_name,
			userId: userId,
			start_datetime: starTime,
			end_datetime: endTime,
			start: start,
        	size: size
		}), 10000, function (code, data) {
            if (code === 2 || code === 1) {
                return callback(2);
            }
            if (code === 0) {
                if (data.code === 0) {
                	callback(0,data);
                } else {
                    callback(1);
                }
            }
        });
	}
    //  end
    //add by ding
    //end
    //add by zhangfuqiang
    // end
    
    // by wangyu
    //end
}(mui, window));